package cn.com.shopec.erp.warehouse.controller;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import cn.com.shopec.erp.common.page.PageFinder;
import cn.com.shopec.erp.common.page.PageQuery;
import cn.com.shopec.erp.common.utils.JsonHelper2;
import cn.com.shopec.erp.purchase.entity.PurchaseRequisitionProduct;
import cn.com.shopec.erp.purchase.service.IPurchaseRequisitionService;

/**
 * 库存报警控制层
 * @author Jack
 *
 */
@Controller
@RequestMapping("/inventoryManagement/inventoryAlarm")
public class InventoryAlarmController {
	
	
	@Resource
	private IPurchaseRequisitionService purchaseRequisitionService;
	
	/**
	 * 跳转至库存报警
	 * @return
	 */
	@RequestMapping("/invenAlarm")
	public ModelAndView commodityWarehouseList(PurchaseRequisitionProduct purchaseRequisitionProduct, ModelMap modelMap){
		modelMap.put("purchaseRequisitionProduct", purchaseRequisitionProduct);
		return new ModelAndView("/warehourse/inventory_alarm");
	}
	
	/**
	 * 获取库存报警的货品
	 * @param purchaseOrderVo
	 * @param pageQuery
	 * @param modelMap
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("ajaxToPoList")
	@ResponseBody
	public String ajaxToPurchaseOrderList(PurchaseRequisitionProduct purchaseRequisitionProduct, PageQuery pageQuery, ModelMap modelMap)
			throws Exception {
		PageFinder<PurchaseRequisitionProduct> pagedBrandList = this.purchaseRequisitionService.purchaseOrderListToInventoryAlarm(purchaseRequisitionProduct,pageQuery);
		modelMap.put("Rows", pagedBrandList.getData());
		modelMap.put("Total", pagedBrandList.getRowCount());
		return JsonHelper2.toJson(modelMap);
	}
	
	
	

}
